package com.muyu.system.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author Administrator
 */

@AllArgsConstructor
@Getter
public enum PriceUpdateTypeEnum {
    CUT_PRICES("降价",1),
    ADD_PRICES("抬价",3),
    NO_CHANGE("不变",2);


    private final String name;

    @JsonValue
    @EnumValue
    private final int code;


    @JsonCreator
    public static PriceUpdateTypeEnum getByCode(int code) {
        for (PriceUpdateTypeEnum value : values()) {
            if (value.getCode() == code) {
                return value;
            }
        }
        return null;
    }
}
